 class LazyMan {
    tasks = [];

    constructor(props) {
        console.log("i am " + props);
        setTimeout(() => this.run())
    }

    run() {
        this.tasks.reduce((p, fn) => p.then(fn),Promise.resolve())
    }

    say(str) {
        this.tasks.push(() => console.log(str))
        return this;
    }

    sleep(timeout) {
        this.tasks.push(() => new Promise(resolve => setTimeout(resolve, timeout)))
        return this;
    }

}
new LazyMan("asd").say("hello").sleep(3000).say("yeah").sleep(3000).say("666").say("qqq")